import BaseModel from '@/common/baseModelV3.js'
import GoodsModel from './goodsModel.js'
export default class EstimateModel extends BaseModel {
	constructor(source, func) {
		super(source, func)
	}
	objecrelation(source, func) {
		var funcModel = func()
		super.funcjudge(funcModel.category)
		return funcModel.category(source)
	}
	objectProcessor(source, func) {
		return new Category(source, func)
	}
	// #ifdef TEST-WEIXIN
	emptyProcessor() {
		for (var i = 0; i < 10; i++) {
			this.data.push(new Category({
				id: 0,
				name: "鞋履",
				list: [{
						title: '安踏冬季新款棉服',
						price: 1900,
						image_url: "https://cdn.uviewui.com/uview/swiper/2.jpg"
					},
					{
						title: '安踏冬季新款棉服',
						price: 1900,
						image_url: "https://cdn.uviewui.com/uview/swiper/2.jpg"
					},
					{
						title: '安踏冬季新款棉服',
						price: 1900,
						image_url: "https://cdn.uviewui.com/uview/swiper/2.jpg"
					},
					{
						title: '安踏冬季新款棉服',
						price: 1900,
						image_url: "https://cdn.uviewui.com/uview/swiper/2.jpg"
					},
				]
			}))
		}
	}
	// #endif
}

class Category extends BaseModel {
	constructor(source, func) {
		super()
		this.id = source?.id || 0
		this.name = source?.name || ""
		this.list = new GoodsModel(source?.list || [], func).data
	}
}
